package com.eh.iteratorAndComposition.modle;

import com.eh.iteratorAndComposition.base.AbstractMenuItem;

/**
 * Created by David on 2016/5/1.
 */
public class MenuItem extends AbstractMenuItem {
    private boolean vegetarian;

    public MenuItem(String name, String description, double price, boolean vegetarian) {
        this.name = name;
        this.description = description;
        this.price = price;
        this.vegetarian = vegetarian;
    }

    @Override
    public boolean isVegetarian() {
        return vegetarian;
    }

    @Override
    public void print() {
        System.out.printf("\t%s%n\t-------%s%n\t-------%f%n\t-------%s%n", name,
                description, price, isVegetarian() ? "素食" : "荤菜");
    }
}
